package tt.dz.biz.service.client;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import tt.dz.base.common.entity.KVObject;
import tt.dz.base.common.rpc.RPCClient;
import tt.dz.base.common.rpc.RPCFactory;
import tt.dz.common.LogUtil;

@Service("osClientService")
public class OSClientService
{
  public void unifyAndCorpPay(String orderNos)
    throws Exception
  {
    try
    {
      KVObject<String, String> param = new KVObject("orderIds", orderNos);
      String resStr = RPCFactory.getInstance().getClient("orderServer").request(param, "unifyAndCorpPay");
      JSONObject jo = JSON.parseObject(resStr);
      LogUtil.info("调用订单系统修改订单支付状态为支付完成接口（unifyAndCorpPay），参为：param=" + param + ",返回结果为：resStr=" + resStr);
      if (!"success".equals(jo.getString("retCode"))) {
        LogUtil.error("修改订单系统的统付和企业支付订单支付状态失败！！！");
      }
    }
    catch (Exception e)
    {
      LogUtil.error("修改订单系统的统付和企业支付订单支付状态失败！！！", e);
      throw e;
    }
  }
}
